<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>change</title>
		<script type="text/javascript" src="../js/jquery-3.3.1.slim.min.js"></script>
		<link href="../css/bootstrap.min.css" rel="stylesheet" type="text/css">
	</head>
	<body>
		<select name="castMode" class="form-control">
			<option value="0">aaa</option>
			<option value="1" selected="">bbb</option>
		</select>
		<div>
			<input name="castServer" class="form-control" placeholder="云服务地址" value="192.168.9.168:8080">
			<input type="hidden" id="aaaHidden" value="192.168.9.168:8080" />
		</div>
		<div>
			<h1>test three eye function</h1>
			<input value="original" id="threeEye" /><br />
			<button onclick="testThreeEye();">click</button>
		</div>
		
		<div>
			<button type="button" id="collectLogId" class="btn btn-outline-info" onclick="testUndefined()">collectLog</button>
		</div>
	</body>
	<script type="text/javascript">
		$(function() {
			console.log("222");
			
		});
		
		function testThreeEye() {
			var a = "222";
			var val = $("#threeEye").val();
			console.log(val);
			$("#threeEye").val(a != null && a != undefined && a != '' && a == '222' ? "yes can" : "no can not");
			var newVal = $("#threeEye").val();
			console.log(newVal);
		}
		
		function castModeChange() {
			var va = $("select[name='castMode']").val();
			console.log(va);
			if ('0' == va) {
				$("input[name='castServer']").val("");
			} else if ('1' == va){
				var hidVal = $("#aaaHidden").val();
				console.log(hidVal);
				$("input[name='castServer']").val(hidVal);
			}
		}
		
		function testUndefined() {
			var a;
			if (a) {
				console.log("yes,a is undefined");
				console.log(a);
				if (a == 'undefined') {
					console.log("yes,a is undefined222");
				} else {
					console.log("no222");
				}
			} else {
				console.log('no a is exist!');
				console.log(a);
			}
		}
	</script>
</html>
